/**
 * 
 * 广州锐鹏计算机科技有限公司（www.ruipengkj.com）
 * 
 * 
 * Copyright (c) 2011-2012 RUIPENGKJ.Co.Ltd. All rights reserved.
 * 
 * */
package com.ruipengkj.service.impl;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.ruipengkj.bean.ViewMenberSalesSummary;
import com.ruipengkj.commons.base.query.BaseQuery;
import com.ruipengkj.commons.base.query.PageModel;
import com.ruipengkj.dao.ViewMenberSalesSummaryDao;
import com.ruipengkj.service.ViewMenberSalesSummaryService;
/**
 * 说明：
 * 会员销售汇总表Service层接口实现
 * @Author：李智深
 * @Date：2012-03-16
 */
@Service
public class ViewMenberSalesSummaryServiceImpl implements ViewMenberSalesSummaryService{

	@Resource
	private ViewMenberSalesSummaryDao ViewMenberSalesSummaryDao;//DAO层

	@Override
	public void deleteService(String id) throws Exception {
		// TODO Auto-generated method stub
		
	}

	@Override
	public List<ViewMenberSalesSummary> findService(
			ViewMenberSalesSummary entity) throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public ViewMenberSalesSummary getByIdService(String id)
			throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public PageModel<ViewMenberSalesSummary> getScrollService(
			int firstResult, int maxResult, ViewMenberSalesSummary entity)
			throws Exception {
		String hql = "select o from ViewMenberSalesSummary o";
		StringBuffer whereHQL = new StringBuffer();
		List<Object> param = new ArrayList<Object>();
		if (entity != null) {
			if(entity.getUserName()!=null&&!entity.getUserName().equals("")){
				whereHQL.append("userName").append(BaseQuery.LIKE).append("?").append(BaseQuery.AND);
				param.add("%"+entity.getUserName()+"%");
			}
			if(whereHQL.length()>4)
				whereHQL.delete(whereHQL.length()-5, whereHQL.length());
		}
		LinkedHashMap<String, String> orderby = new LinkedHashMap<String, String>();
		return ViewMenberSalesSummaryDao.getScrollDao(hql, whereHQL.toString(), param, firstResult, maxResult, orderby);
	}

	@Override
	public void modifyService(ViewMenberSalesSummary entity)
			throws Exception {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void saveOrUpdateService(ViewMenberSalesSummary entity)
			throws Exception {
		// TODO Auto-generated method stub
		
	}

	@Override
	public Serializable saveRetService(ViewMenberSalesSummary entity)
			throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void saveService(ViewMenberSalesSummary entity)
			throws Exception {
		// TODO Auto-generated method stub
		
	}

	public ViewMenberSalesSummaryDao getViewMenberSalesSummary() {
		return ViewMenberSalesSummaryDao;
	}

	public void setViewMenberSalesSummary(
			ViewMenberSalesSummaryDao ViewMenberSalesSummaryDao) {
		this.ViewMenberSalesSummaryDao = ViewMenberSalesSummaryDao;
	}
	
	@Override
	public List<ViewMenberSalesSummary> findExportService(
			ViewMenberSalesSummary entity) throws Exception {
		String hql = "select o from ViewMenberSalesSummary o";
		StringBuffer whereHQL = new StringBuffer();
		List<Object> param = new ArrayList<Object>();
		if (entity != null) {
			if(entity.getUserName()!=null&&!entity.getUserName().equals("")){
				whereHQL.append("userName").append(BaseQuery.LIKE).append("?").append(BaseQuery.AND);
				param.add("%"+entity.getUserName()+"%");
			}
			if(whereHQL.length()>4)
				whereHQL.delete(whereHQL.length()-5, whereHQL.length());
		}
		LinkedHashMap<String, String> orderby = new LinkedHashMap<String, String>();
		return ViewMenberSalesSummaryDao.findDao(hql, whereHQL.toString(), param, orderby);
	}
}
